package com.grm.sys.service.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.grm.sys.entity.SysRole;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 系统角色映射器
 *
 * @author gaorimao
 * @date 2022/06/24
 */
public interface SysRoleMapper extends BaseMapper<SysRole> {
    /**
     * 通过userId查询角色列表
     *
     * @param userId 用户id
     * @return sysRoles
     */
    @Select("select sr.* from sys_role sr left join sys_user_role sur on sr.id = sur.role_id where sur.user_id = #{userId}")
    List<SysRole> querySysRolesByUserId(Long userId);
}
